﻿using Abp.Dependency;
using Abp.Domain.Repositories;
using Abp.Events.Bus.Entities;
using Abp.Events.Bus.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FwProject.Core.Car;
using Abp.Runtime.Caching;
using FwProject.Authorization.Users;
using FwProject.Authorization.Roles;

namespace FwProject.Application.EventHandl
{
    public class RoleHandle : IEventHandler<EntityChangedEventData<Role>>,ITransientDependency
    {
        public readonly ICacheManager _catchmanager;
        public RoleHandle(ICacheManager catchmanager)
        {
            _catchmanager = catchmanager;
        }
         /// <summary>
         /// 删除缓存
         /// </summary>
         /// <param name="eventData">Event data.</param>
        public void HandleEvent(EntityChangedEventData<Role> eventData)
        {
            ICache cache = _catchmanager.GetCache(nameof(Role));
            cache.Remove("list");
        }
    }
}
